package com.jvm.栈内存溢出;

/*
    递归调用方法，压入栈帧过多导致溢出  StackOverflowError
 */
public class 栈内存溢出 {
    static int i = 0;
    public static void main(String[] args) {
        try {
            method();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            System.out.println(i);
        }
    }

    public static void method(){
        i++;
        method();
    }
}
